package shiyan.Javawebshiyan.shiyan2.src;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class ShowLetter extends GenericServlet {
    @Override
    public void service(ServletRequest request, ServletResponse response)
            throws ServletException, IOException {
        // 设置响应内容类型和字符编码
        response.setContentType("text/html;charset=utf-8");
        // 获取PrintWriter对象用于向客户端输出数据
        PrintWriter out = response.getWriter();
        // 输出HTML页面
        out.println("<html><body>");
        // 输出英文大写字母表
        out.print("<BR>英文大写字母: ");
        for (char c = 'A'; c <= 'Z'; c++) {
            out.print(c + " ");
        }
        // 输出英文小写字母表
        out.print("<BR>英文小写字母: ");
        for (char c = 'a'; c <= 'z'; c++) {
            out.print(c + " ");
        }
        // 结束HTML页面
        out.println("</body></html>");
    }
}